import sqlite3
conn = sqlite3.connect('users.db')
c = conn.cursor()

# 创建用户表（如果不存在）
c.execute('''CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)''')

# 插入一些测试数据（如果表为空）
c.execute('''INSERT INTO users (id, name) SELECT 1, 'Alice' WHERE NOT EXISTS (SELECT 1 FROM users WHERE id = 1)''')
c.execute('''INSERT INTO users (id, name) SELECT 2, 'Bob' WHERE NOT EXISTS (SELECT 1 FROM users WHERE id = 2)''')
c.execute('''INSERT INTO users (id, name) SELECT 3, 'Mike' WHERE NOT EXISTS (SELECT 1 FROM users WHERE id = 3)''')
conn.commit()
conn.close()